fixed resizing bug which was introduced during rewrite and the mixing of...

... global and just predefined variables