Fix obvious bugs with using ceil(x)