fixed some bugs here and there