Bugfixes and added new exception