null pointer in Xstatrecord