fixed corner case and added test case for when output is false