added new rule and fixed some code