
965 So.2d 1284 (2007)
Aaron MARSH, Appellant,
v.
STATE of Florida, Appellee.
No. 2D04-4884.
District Court of Appeal of Florida, Second District.
October 17, 2007.
*1285 James Marion Moorman, Public Defender, and Deborah K. Brueckheimer, Assistant Public Defender, Bartow, for Appellant.
Bill McCollum, Attorney General, Tallahassee, and Jonathan P. Hurley, Assistant Attorney General, Tampa, for Appellant.
PER CURIAM.
Aaron Marsh appeals the trial court's denial of his motion to dismiss, asserts that the trial court erroneously imposed certain costs, and claims that the trial court failed to give him proper credit for time served. We reverse the trial court's order solely as to the imposition of certain costs and affirm in all other respects.[1]
Marsh challenges the trial court's order imposing a $65 cost "pursuant to F.S. 939.185(1)." Section 939.185 became effective on July 1, 2004, ch.2004-265, § 88, at 1022-23, Laws of Fla., and is effective as to crimes committed after that date, Navicky v. State, 949 So.2d 1047, 1048 (Fla. 2d DCA 2006). Marsh's crime was committed on July 23, 2003, before the statute came into existence. Therefore, the cost was erroneously imposed.
Marsh also challenges the trial court's order imposing a $50 cost "pursuant to F.S. 775.083(2)." Although the imposed cost was mandatory under the 2004 version of section 772.083(2), the version of this statute in effect at the time of the commission of the crime was discretionary and required that the trial court find that the defendant had the ability to pay. § 775.083(2)(b), Fla. Stat. (2003) ("[T]he court may order the defendant to pay such fine if the court finds that the defendant has the ability to pay the fine and that the defendant would not be prevented thereby from being rehabilitated or making restitution."). Because the trial court imposed this discretionary cost without conducting the required inquiry, the cost must be stricken. See Gonzalez v. State, 939 So.2d 224, 225 (Fla. 2d DCA 2006); Stewart v. State, 916 So.2d 53, 54 (Fla. 2d DCA 2005).
Accordingly, we strike the $65 court cost imposed pursuant to section 939.185(1) and the $50 cost imposed pursuant to section 775.083(2)(b) and remand to the circuit court to correct the judgment. On remand, the trial court may reimpose the $50 cost pursuant to section 775.083(2)(b) if it conducts the necessary hearing and makes the required findings.
Affirmed in part, costs stricken as noted, and remanded.
WHATLEY and CASANUEVA, JJ., and FOSTER, ROBERT A., Associate Judge, Concur.
NOTES
[1]  Marsh preserved the cost and fine issues for appeal by filing a motion pursuant to Florida Rule of Criminal Procedure 3.800(b)(2).
