added --init param and fixed bug