fixed ref problems after coffeescript port reverting