port flex from nib, fix incorrect image-replace alias introduced by #31