fixed out of range issue in compatibility mode