Fix regex bugs