fixes cascade delete, adds test