fixed a bug of NPE