Modified to avoid creating unnecessary return object. Refs #9949.