fixed validation of user input in formatter