Various fixes

Updates from master that wouldn't merge