Better locking when mounting images to be more thread-safe