fixed a bug (NullPointerException)