This fixes #1 and fixed #2 issues