Make replaceRule async

FIXME: check/invalidate the cache for loading CPS