Improve s:print_error function