fixed remove function bug