debug and fixes