try except added to prevent unexpected error