Crashing bug fixed. Was caused by calling main-subroutine recursively until stack space ended.