Fixed NPE.

Stack trace from Tomcat: https://gist.github.com/slovdahl/5c9700494df372429bc2