Finishing up bugfixes