fixed some bugs. added -d flag