Fix typo in db get_packageinstance_byvalues() and tidy controller.
Fix bug in db get_buildenv_suitearch_id().