fixed plug and added tests