Fixed sapply and lapply in getApplyFunction and getLApplyFunction