bug fix: should use Math.floor not floor