fix a bug and remove disused code