fixed serveral issues