Fixing notice errors

Fixed instances where undefined indexes were referenced.