Fixed a problem that caused the main thread to freeze for ~10 seconds when taking a photo.