Fixed some silly assignment errors in the read function