avoid using anonymous functions in sapply() within gdispweight