fixed some bugs @brian