Bugfix/issues 2013 06

Fixing several issues.