Temporary fix for crashing bug in qm_map_cg. Replaced simple match statements with if then else.