fixed some bugs danni pointed out