avoid error adding custom field when adding last event name field

Thanks Stuart and Edith for reporting the bug.
ensure we get proper message on failure.
removing unused variable and offering better comments.