fix insertfile and exceptions