final fix to amazon rds, and sql queries in calcs controller