adding some extra defensive programming