fixing refs and such