Merge "Add check for ref being a string before applying regex"