fixed to work when called from widget template.