Made small fixes regarding null exceptions