Added try/catch block. Fixed #1484