Fixed code that breaks app