Various fixes and changes