some fixes and added output