Several fixes for issues