fixed bugs reagrding delete