fixed a bug involving err_map computation