fixed empty input handling