modify ex function to use exit code
fix ex
some changes (notify)