regex tweaks and fixes