FIX Some mongo problems and wrong if.
IMP All period procesing is done as string & wrong condition