fixed various bugs when calculating of extension's id, #10