Modified TEMPLATEPATH to STYLESHEETPATH and template_url to get_stylesheet_directory_uri. Now it works for child themes or parent themes as well.