Test and a few fixes