fixed some bugs on resources.py