fix $LS is not always populated in templates