Added check for port already in use