fix off by one bug in converting resources