Bugfixes and codechanges inside tool_doclone.php