Fix int casting. Fix cond testing. Fix params in sql stmt.
Fix int casting. Fix cond testing. Fix params in sql stmt.

southskies/osdial,southskies/osdial,southskies/osdial,southskies/osdial,southskies/osdial