Add library sub states and fix test