fixed validate function and added filter for validation #27