Fix warnings (and bugs)