A few bug-fixes