Fixed issue with nested assignments, added tests