Added some paranoid crash checking log messages and fixed some potential
crashes