Backport master fix for username case sensitivity problems