Add lib directory and fixed compile bug