Fixed runtime exception in rewritng engine.