Fix regexes and loggig