Fix bug with new removeItemOfType function