Fixed couple of annoying bugs