some fixes and improvements

I think, not sure, it's been a while since I made these.