Fixed some 'I don't know how it worked' bugs