fix for attachEntity issue + typescript work