Correction various bugs