Bug fixes in functions_helper.php