Fixed crashes

1. Fixed issue related to the Triangle app stopping abruptly
2. Fixed issue on the application exit
3. Fixed an issue that resulted in a crash when an input like 3,3,   was
entered in the input text field.