hopefully fixed two major bugs