Improved resources fetching and fixed various bugs