update sql and fix tag lib function bug