fix bug with resource being called more than once