Fixed bugs when unbinding.