Fixed some errors and StyleCop related stuff

In the mean time i fixed two errors and some StyleCop related issues. May we add a Header (author, modification date, copiright clause, etc.) to each file?