fixded some NullPointer exceptions