add modal and fixed bugs