Fixed error in advert form and added some tests