Sub attribute parsing fixes and unit tests
fixes #116
fixes #117