closed #5005, fix a null pointer exception