Fix most bugs - only one issue remains