attaching onend behaviors