improved input field check