Fixed memory leak in apply_communication rule