Fix bug in extracting block when encountering optional nil arguments