refine data access and make map directive work