merged and fixed #1