Check for NPE when writing sessionid