Fix for a leak which was causing a NullPointerException.