add delay option; fix bugs;