changed the htoi func