Move PORTSDIR detection upwards and add echo.