fixed potential memory access violation