Fixed issues with selecting the correct record for updating