Merge fixes from refind script