fix bugs of referencies