Fix resource reading problem