Fix warnings and notices