fix bug with const declaration in func