add hf.py
fix few bugs