fix undefined index $sub