Updated python reading code (fixed bug)