Changed around the try except block