Fix empty file bug