fixed parameter order for array_key_exists in main.php