FIX some bugs