replaced die() with exit()