implemented serial error handling