Fix dictionary update and key issues, update tests