Added try catch to prevent errors
Bugfix