Correct segmentation fault when asking for an invalid layer_index in layer_name function

And removed #include <stdio.h> (which is more for C language than C++)