Fixed compilation errors for reference-returning functions