Fixed bug in scoremanager and added dirty flag