Added typecasting for SQL insertion and update.