float<->int conversion with a few less bugs (actually works for the first time)