Improved API input validation for Node (#304)