fix multiple key bugs and update tests