added safe_input() wrapper function