Fix issue with compiling ranges with functions