handle empty file edge case, more robust error handling