Fix wrong code for resource retrieval