Fix bug in print method