bug fixes for remove method