fix corner cases and modify design