Changed perror to printf