Try moving buttons' creation to later to prevent their click handlers from breaking;