Forgot to make the S replacement case-sensitive. 

Fixed this by replacing explicitly the first character of the match.