Adding a couple bug fixes