fixed potential leaks on errors and invalid initializers

enum -> NS_ENUM for consistency