Various bug fixed