BUG: Fix Issue #2422 by adding const qualifier. Add test case.