Use user object ID instead of userprofile object id
Actually, this explains why I was facing issues with using the object directly- I was comparing the user profile object to the user object
Last two commits fix #3