time conversion + a few bugs