Fix bug, add main