adding try and except