Fix bugs in record_is_locked_for_edit and render