Adding a few bugfixes