checking to make sure cast is pointing to right page