Updated magic file error checking