Bug fixes, added HttpException, fixed bug in db module