Fix a bug with data; Add more doctests