various fixes added for stabillity