improved imap.py to do proper normalization for upup_map