Update functions.sh

Fix for issue #2