Added setPortDirection