fixing bugs in encounter-form directive