fix bootstrap and refactor