Qubit measurement is followed by instructions. Error code: 7006 [duplicate]

Trying quantum teleportation in https://github.com/Qiskit/qiskit-textbook/blob/master/content/ch-algorithms/teleportation.ipynb

Succesful runs in 'qasm_simulator', but when switching to IBMQBackend('ibmqx2') I get IBMQJobFailError

The error is caused by appending gates onto qubits following a measurement. On qubit 1 and qubit 0, you attach a cx gate after a measurementhas already been placed. This will compile on the simulator, but it is not something that is supported on the real hardware.