fixed non-object bug
fixed database error after activation
db query optimization