fix the NSNull and nil bug