edited the code used to build error map