Fix and improve test