Bugfix in variable initialization and minor changes