fix some bug AND NullPointerException