Many fixes for loading binary files