[FIX] various bugs