added semantic checks for return types