copied some stuff over from scottsfix
fixed bug in base