add a tpl func `empty` that check the input is empty
fix the redirect method