Properly check for 'params' key before using