Added protection from invalid input. DB issues.