fixed quit-function