small tweaks and bugs fixed