Fixed a bug that was causing an NPE.