BugFix and minor improvements