Added error guard