fix customport issue and further javascript improvements.