Main bug fixed