try to fix reliability of has_metadata (left debugging statements in)
strip debug statements