Added some error handling to prevent errors from propegating to the
client side