Bugfix and error control!