Bug fix create/attach to daemon and added test script