fixing object reference problems