Return nil if data is invalid