Fix incorrect variables reference in createRequestFunction