bug fixes. still not working properly