hopefully fixed ref problems