Regex bug fixes