Fix test hooks order

Closes #647