Fix warnings and tests