Update gems
Add error handling and debugging