Fix test errors

see #276, #277 and #278