Fixing headless terminal issue