fixed some mad bugs