tests reveal a mistake in clip_edges! fixed, and implemented test