Fixed some previous bugs