fixed some basic stuff for compatibility

and re-wrote some stuff for tabbing problems