Fix bugs to find commands like gradle and endpointscfg.py