Fix warnings and source tests