Various fixes and adjustments