modify jpeg data reading routine