Added some error handling

even smaller update