try catch and some minor changes for buttons