bugfixes
add bad file check