fix issue 7: tryCatch for printing output