Wrong string comparison in print function