Fixing bug in regex