Fixed script to work correctly on SmartOS.