fix null object reference bug