added check if template result is empty. if so - die() - #152