Fixed fatal bugs