fixed ui ref bugs