Fixed dancing bug due to class-cast error