fix blogpost code bug in mock_open