Fix IllegalOperationError when running scratch-flash