Fixing some errors in Functions