fixed bugs with latest changes
made enable/disable buttons smarter
made delete button smarter