Bug fixes

**Ready to merge**

Fixing bugs...