fix warnings and improve test