bug in accessing app state