shouldn't be : !webResource.isLastResource() instead of webResource.isLastResource() like in lines before?