Handle empty lines properly