exception handling on main buttons