function safeInput() is updated