fixed delete function and routing errors