solved firefox issue in which i had to use math.floor