fixed bug in dynamics