fixed ht2 problem 3 implementation