fixed an infinite loop in empty files