Added try and catch to avoid crashing.