fix animal pen join query