Add some error checking, and fixed a json error I had on my laptop