The original code was not working if port and baud was not exported as separate environmentak varaibles.