modified rules, fixed bug in update