hs function is acting really weird