fixed some issues to make it run