Fixes bug

closes #583