It seems i've forgotten to add (string) type casting here. Problem with empty() is that id can be 0.