modify jpeg read routine