Fixed an error that happened when choosing the random motion option.