Test and fix for within_frame issue #686