fixed a locking bug for using jpeg reader