josh - updating all the libs and some more defensive programming