try except instead of if else