Added 2 fixes for NPE with Tomcat7, see https://issues.apache.org/bugzilla/show_bug.cgi?id=55552