fix some javascript bugs, and styling