Added delete test and fixed delete bug