Fix old hats function