fixed cancelling since return is not valid inside a block