fixing Math.floor error