fixed scope and range errors