Fixed remaing bugs so tests run properly again