added check for leave block