use `substring(0, 1)` instead of `[0]`

because IE7 does not support the latter one.