Bug fixes for parsing files