added -v parameter, fixed bug