update switchable add function to fix insertfore last index bug