fixed readAttributes and added more unit test