[Unreviewed][FIX] Fix various bugs