improved code formatting, fixed a missing [] in types.js, added BIT(1) casting in database.js