fix and improve testing