Fix gradle
ORDERED->ORDER
Various db and sync fixes