handle empty input properly