ugly, but it works...