Fix double delete bug