fix implementation for initializing port