fixed some bugs may cause null point exception