Fixed infinite loop bug. Added so that non-called functions generate error