Fix some bugs in rave environment setup and fix the end so that joint goals work (not sure if that was supposed to be necessary).