[FIX] Proper port detection on templates
Merge pull request #2261 from MPOS/port-in-template

[FIX] Proper port detection on templates