Fixed bugs observed by Alberto