filterBy('intendedTemplate', '....' ) does not return the intended page object

Just shooting from the hip: I assume the filterBy method to return a collection, not a single page object. Then $data will contain an array, not a single value.

Just a guess without more elaboration.