fixed bug/added else branch