prevent from writing empty array