several fixes. Almost works