tests added, closes #308, closes #317