added spec file and fixed some bugs