A few bug corrections