Update functions.sh

wrong code before. fixed.