fixed bug and split generated files into source and header