Small fixes
bug fixes and improvements