Use wider numeric types in mysql. Add some logs.