fixed a bug that was causing the printouts to throw exceptions.