Fixed potential error on save when checking if record exists.