Fixing of some minor (potential) bugs.