Final (hopefully) bug fixes