Several fixes