The assignment to $frag is dead. Consider omitting it.
Some properties are not defined.