added try/except block