raise proper error on empty file