added port paramater and paramater check