Fixing application flow bug