fixes #652 advanced app fixes
fixes #651
fixed code style
Added new boolean attributes.
Added typecasting for SQL insertion and update.
Fixed test breaks.