fixed bug in code to get app to work properly