fixed bug at choosing internal reference