Added quick fix for case when menuButton type is undefined, condition moved to separate variable.