fixed client js script; fixed EventPayload::encode