Bugfixes (get rid of out of range errors)