Removed intval() from toInteger() and minor fix