check length first