fixed issues in escaping the ansi sequence in devices(),links() and ports() functions