fixed some server-side error-handling and logging issues.