fixes #5873, changed default value and fixed bugs, fully tested now