Fixed some issues in library and minectl