fixed a bug about null check