Fix and enhanced tests