fixed applyRule where non empty rhs's where not working