implemented some security against sql overflow