Bug corrections and some additions