Fix for wrong file length check