Fixed overflow adjustment bug, used wrong variable name
Fixed scaling adjustment bug, scaleFactor should only be updated once