Fixed legacy code

Fixes #492