Improve type checking
Javascript integer division handling