Sync framework

Signed-off-by: Arief M Utama <arief.utama@gmail.com>
Fixes for sql queries

Signed-off-by: Arief M Utama <arief.utama@gmail.com>