added user input integrity check