dynamic sleep time, fix return status