Bugfix of read function.