Bug fix: check if app pointer is good