Stack overflow bug


Solved a bug causing a stack overload. Solved other minor bugs.