fixed contextio#resource_as_entity error and improve datastore module