fix various bugs from a bad source file