replaced getline() by fgets() for compatibility reasons