Added some injection safety precaution
Tweaked main.cpp