fix nullreference exception