Fixed bug

Adding bug fixes from main application into feature branch