fixed pendulum bug