NullPointer Error bug fix