Fixed bugs

I made some fixes to bugs #4 and #6 that I thought you might want to see.