js callbacks for serial functions