fix the issue with finish block being called twice