Fixed bug in main app