use ternary operators in portmapping