fix visibility bug which leads to exception