resource code fixes/cleanup