Improved all of the error logging in CCPDatabase.m. Also fixed a possible memory corruption issue.