fix buildURL for deeply nested resources