Better fix for regex bug