error check port and make input more robust