Added check for valid attitude data.