fixed index 0 handling for null check