Fix filter for when writable is False

Also add a test case.