Fixed sp code