Added exception handling in serial callback