Added port scanner and fix some bugs