Fixed Example so that the program does not crash