Fixed some introduced bugs