Fix permissions and pass flags to doctest.