modified jpeg read routine