Fixes when array is empty, or when passing an integer as a boolean (from a database, for example)