Several fixes I found to be needed