Wrong offset calculation because of floating point values