fix hmsToMs function