fix variance to take trait bounds into account, fix tests