Improved error messages and fixed read_all