Fixed read and added debug prints, just in case.