Null reference crash fixed