[update] more defensive code on adding buttons