clean invalid code