Move tags list query

Undefined variable

Fix some wrong variables