Several bugs resolved