fixed backwards compatability issues (sorry for the mess)