Fixed the bug.  It was a scope issue in entity.cpp.