fixed some miscellaneous bugs