use defaultdicts; dont allow nan to pass silently