Fixed handling of applications