override `remove` function to fix #1140