security enhanced and bugs fixed