fixed some general bugs