fixed problem with reg variable (pattern)