Several fixes and adjustments