Various fixes from testing